package com.lx.oms.controller.controller;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lx.oms.common.annotation.SysLog;
import com.lx.oms.common.controller.AbstractController;
import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.R;
import com.lx.oms.controller.entity.QuotationAnalysisEntity;
import com.lx.oms.controller.service.QuotationAnalysisService;

/**
 * 行情分析
 *
 * @author houzhong
 * @date 2018年7月19日 上午11:16:01
 */
@RestController
@RequestMapping("/sys/quotationanalysis")
public class QuotationAnalysisController extends AbstractController {
	
	@Autowired
	private QuotationAnalysisService quotationAnalysisService;
	
	/**
	 * 列表
	 * @param params
	 * @return
	 */
	@RequestMapping("/list")
	public Page<QuotationAnalysisEntity> list(@RequestBody Map<String, Object> params) {
		return quotationAnalysisService.listQuotationAnalysis(params);
	}
		
	/**
	 * 新增
	 * @param tQuotationAnalysis
	 * @return
	 */
	@SysLog("新增行情分析")
	@RequestMapping("/save")
	public R save(@RequestBody QuotationAnalysisEntity quotationAnalysis,String contentStr) {
		quotationAnalysis.setContent(contentStr);
		return quotationAnalysisService.saveQuotationAnalysis(quotationAnalysis);
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@RequestMapping("/info")
	public R getById(@RequestBody String id) {
		BigInteger bId = new BigInteger(id);
		return quotationAnalysisService.getQuotationAnalysisById(bId);
	}
	
	/**
	 * 修改
	 * @param tQuotationAnalysis
	 * @return
	 */
	@SysLog("修改行情分析")
	@RequestMapping("/update")
	public R update(@RequestBody QuotationAnalysisEntity quotationAnalysis,String contentStr) {
		quotationAnalysis.setContent(contentStr);
		return quotationAnalysisService.updateQuotationAnalysis(quotationAnalysis);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除行情分析")
	@RequestMapping("/remove")
	public R batchRemove(@RequestBody String[] id) {
		return quotationAnalysisService.batchRemove(id);
	}
	
}
